Invoking [SKProductsRequest start] hangs on iOS 4.0

Posted by figelwump on Stack Overflow See other posts from Stack Overflow or by figelwump
Published on 2011-01-06T22:41:30Z Indexed on 2011/01/07 4:54 UTC
Read the original article Hit count: 162

Encountering an issue with SKProductsRequest that is specific to iOS 4.0. The problematic code:

- (void)requestProductData
{
    NSSet *productIdentifiers = [NSSet setWithObjects:kLimitedDaysUpgradeProductId, kUnlimitedUpgradeProductId, nil];

    self.productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:productIdentifiers];

    self.productsRequest.delegate = self;

    [self.productsRequest start];
}

- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response
{
     NSLog(@"didReceiveResponse");
}

When [SKProductsRequest start] is invoked, the productsRequest:didReceiveResponse: delegate method is never invoked; further, the entire app hangs and is completely unresponsive to input. Obviously, this is a huge issue for our iOS 4.0 users as it not only breaks payments but makes the app completely unusable.

Some other things to note: this only happens on iOS 4.0; iOS 4.2, 3.x are fine. Also: if the delegate is not set on the SKProductsRequest (i.e. comment out the line "self.productsRequest.delegate = self;"), the app doesn't hang (but of course in that case we have no way of getting the product info). Also, the problem still reproduces with everything stripped out of the productsRequest:didReceiveResponse: callback (that method never actually gets called). Finally, if the productIdentifiers NSSet object is initialized to an empty set, the hang doesn't occur.

Has anybody else experienced this? Any ideas/thoughts on what could be going on here, and how we might be able to work around this?

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk-4.0